<?php /* @var $this Controller */ ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="en">
	<?php echo Yii::app() -> bootstrap -> register();?>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css"/>
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>

<body>

<div class="header" id="header">
<?php 
if(Yii::app() -> user -> isGuest){
	$userProfileMenu = array(
			'class'=>'bootstrap.widgets.TbMenu',
			'htmlOptions'=>array('class'=>'pull-right'),
			'items'=>array(
					'/',
					array('label'=>Yii::t('baby','注册'), 'url'=>'#register-form','linkOptions'=>array('role'=>'button','data-toggle'=>'modal')),
					array('label'=>Yii::t('baby','登录'), 'url'=>'#login-form','linkOptions'=>array('role'=>'button','data-toggle'=>'modal')),
	));
}else{
	$userProfileMenu = array(
			'class'=>'bootstrap.widgets.TbMenu',
			'htmlOptions'=>array('class'=>'pull-right'),
			'items'=>array(
					'/',
					array('label'=>'上传', 'url'=>$this -> createUrl('/educators/audios/create')),
					//array('label'=>'上传照片', 'url'=>$this -> createUrl('/post/create')),
					array(
							'label'=>Yii::app() -> user ->data() -> getAvatar(true),
							'url'=>$this -> createUrl('/profile'),
							'linkOptions'=>array('title'=>Yii::app() -> user -> name), 
							'items'=>array(
								array('label'=>Yii::t('baby','我的'), 'url'=>Yii::app() -> user -> profileUrl),
								array('label'=>Yii::t('baby','管理后台'), 'url'=>$this -> createUrl('/sadmin'),'visible'=>(int)Yii::app() -> user ->isAdmin()),
								array('label'=>Yii::t('baby','编辑个人资料'), 'url'=>$this -> createUrl('/setting/profile')),
								'---',
								array('label'=>Yii::t('baby','消息'), 'url'=>'/message'),
								//array('label'=>'Something else here', 'url'=>'#'),
								'---',
								array('label'=>Yii::t('baby','设置'), 'url'=>$this -> createUrl('/setting')),
								array('label'=>Yii::t('baby','退出'), 'url'=>$this -> createUrl('/logout')),
							)),
			));
	}

	$this->widget('bootstrap.widgets.TbNavbar', array(
    'type'=>'inverse', // null or 'inverse'
	'type'=>'', // null or 'inverse'
    'brand'=>'首页',
    'brandUrl'=>'/',
    'collapse'=>true, // requires bootstrap-responsive.css
    'items'=>array(
        array(
            'class'=>'bootstrap.widgets.TbMenu',
            'items'=>array(
            	array('label'=>Yii::t('baby','听听'), 'url'=>$this -> createUrl('/ting')),
                array('label'=>Yii::t('baby','发现'), 'url'=>$this -> createUrl('/discover')),
            	array('label'=>Yii::t('baby','教育家'), 'url'=>$this -> createUrl('/tag')),
                array('label'=>Yii::t('baby','榜单'), 'url'=>$this -> createUrl('/top')),
//            	array('label'=>Yii::t('baby','视频'), 'url'=>$this -> createUrl('/video')),
            	array('label'=>Yii::t('baby','教育家入口'),'url'=>$this -> createUrl('/educators')),
            	array('label'=>Yii::t('baby','社区'),'url'=>Yii::app() -> params -> bbs),
                /*array('label'=>'儿童中心', 'url'=>'#', 'items'=>array(
                    array('label'=>'成长乐园', 'url'=>$this -> createUrl('/kidsCenter/park')),
                    /*array('label'=>'Another action', 'url'=>'#'),
                    array('label'=>'Something else here', 'url'=>'#'),
                    '---',
                    array('label'=>'NAV HEADER'),
                    array('label'=>'Separated link', 'url'=>'#'),
                    array('label'=>'One more separated link', 'url'=>'#'),*/
                /*)),*/
            ),
        ),$userProfileMenu,
    	'<form class="navbar-search pull-right" action="/search">
    		<div class="form-group">
              <input type="text" name="s" class="form-control" placeholder="">
      		  <button type="submit" class="btn btn-default search_btn">搜索</button>
        	</div>
    	</form>',
    ),
)); ?>
</div>

<div class="container">

	<?php 
	$this->widget('bootstrap.widgets.TbAlert', array(
			'htmlOptions'=>array('style'=>'margin-top:20px'),
	        'block'=>true, // display a larger alert block?
	        'fade'=>true, // use transitions?
	        'closeText'=>'X', // close link text - if set to false, no close link is displayed
	        'alerts'=>array( // configurations per alert type
	            'success'=>array('block'=>true, 'fade'=>true, 'closeText'=>'x'), // success, info, warning, error or danger
	        ),
	    ));
	?>
        
	<?php echo $content;?>
</div>


<div class="footer">
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-sm-4 space-mobile">
                    <!-- BEGIN ABOUT -->                    
                    <h2>关于我们</h2>
                    	<p class="margin-bottom-30">
                    		
                    	</p>
                    <div class="clearfix"></div>                    
                    <!-- END ABOUT -->          

                    <h2>Photos Stream</h2>
                    <!-- BEGIN BLOG PHOTOS STREAM -->
                    <!-- END BLOG PHOTOS STREAM -->                              
                </div>
                <div class="col-md-4 col-sm-4 space-mobile">
                    <!-- BEGIN CONTACTS -->                                    
                    <h2>Contact Us</h2>
                    <address class="margin-bottom-40">
                        Loop, Inc. <br>
                        795 Park Ave, Suite 120 <br>
                        San Francisco, CA 94107 <br>
                        P: (234) 145-1810 <br>
                        Email: <a href="mailto:info@keenthemes.com">info@keenthemes.com</a>                        
                    </address>
                    <!-- END CONTACTS -->                                    

                    <!-- BEGIN SUBSCRIBE -->                                    
                    <h2>Monthly Newsletter</h2>  
                    <p>Subscribe to our newsletter and stay up to date with the latest news and deals!</p>
                    <form action="#" class="form-subscribe">
                        <div class="input-group input-large">
                            <input class="form-control" type="text">
                            <span class="input-group-btn">
                                <button class="btn theme-btn" type="button">SUBSCRIBE</button>
                            </span>
                        </div>
                    </form>

                    <!-- END SUBSCRIBE -->                                    
                </div>
                <div class="col-md-4 col-sm-4">
                    <!-- BEGIN TWITTER BLOCK -->                                                    
                    <h2>Latest Tweets</h2>
                    <dl class="dl-horizontal f-twitter">
                        <dt><i class="icon-twitter"></i></dt>
                        <dd>
                            <a href="#">@keenthemes</a>
                            Imperdiet condimentum diam dolor lorem sit consectetur adipiscing
                            <span>3 min ago</span>
                        </dd>
                    </dl>                    
                    <dl class="dl-horizontal f-twitter">
                        <dt><i class="icon-twitter"></i></dt>
                        <dd>
                            <a href="#">@keenthemes</a>
                            Sequat ipsum dolor onec eget orci fermentum condimentum lorem sit consectetur adipiscing
                            <span>8 min ago</span>
                        </dd>
                    </dl>                    
                    <dl class="dl-horizontal f-twitter">
                        <dt><i class="icon-twitter"></i></dt>
                        <dd>
                            <a href="#">@keenthemes</a>
                            Remonde sequat ipsum dolor lorem sit consectetur adipiscing
                            <span>12 min ago</span>
                        </dd>
                    </dl>                    
                    <dl class="dl-horizontal f-twitter">
                        <dt><i class="icon-twitter"></i></dt>
                        <dd>
                            <a href="#">@keenthemes</a>
                            Pilsum dolor lorem sit consectetur adipiscing orem sequat
                            <span>16 min ago</span>
                        </dd>
                    </dl>                    
                    <!-- END TWITTER BLOCK -->                                                                        
                </div>
            </div>
        </div>
    </div>


<div class="copyright">
        <div class="container">
            <div class="row">
                <div class="col-md-8 col-sm-8">
                    <p>
                        <span class="margin-right-10"><?php echo date('Y',time())?> © Metronic. ALL Rights Reserved.</span> 
                        <a href="#">Privacy Policy</a> | <a href="#">Terms of Service</a>
                    </p>
                </div>
                <div class="col-md-4 col-sm-4">
                    <ul class="social-footer">
                        <li><a href="#"><i class="icon-facebook"></i></a></li>
                        <li><a href="#"><i class="icon-google-plus"></i></a></li>
                        <li><a href="#"><i class="icon-dribbble"></i></a></li>
                        <li><a href="#"><i class="icon-linkedin"></i></a></li>
                        <li><a href="#"><i class="icon-twitter"></i></a></li>
                        <li><a href="#"><i class="icon-skype"></i></a></li>
                        <li><a href="#"><i class="icon-github"></i></a></li>
                        <li><a href="#"><i class="icon-youtube"></i></a></li>
                        <li><a href="#"><i class="icon-dropbox"></i></a></li>
                    </ul>                
                </div>
            </div>
        </div>
    </div>


<?php if(Yii::app() -> user -> isGuest):?>

<!-- Modal -->
<div id="login-form" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">登陆</h3>
  </div>
  <div class="modal-body">
  
    <?php
	$loginForm = new YumUserLogin('login');
      $form=$this->beginWidget('CActiveForm', array(
		'id'=>'login-form',
      	'action'=>'/user/auth',
		'enableClientValidation'=>true,
		'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
	)); ?>
	
		<div class="modal-row">
			<?php echo $form->labelEx($loginForm,'username'); ?>
			<?php echo $form->textField($loginForm,'username'); ?>
			<?php echo $form->error($loginForm,'username'); ?>
		</div>
	
		<div class="modal-row">
			<?php echo $form->labelEx($loginForm,'password'); ?>
			<?php echo $form->passwordField($loginForm,'password'); ?>
			<?php echo $form->error($loginForm,'password'); ?>
		</div>
	
		<div class="modal-row buttons">
			<?php echo CHtml::submitButton('登陆',array('class'=>'btn btn-info')); ?>
		</div>
	
	<?php $this->endWidget(); ?>
	     
  </div>
  <div class="modal-footer">
    <button class="btn hide" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-danger"  data-dismiss="modal" aria-hidden="true">关闭</button>
  </div>
</div>


<!-- Modal -->
<div id="register-form" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">注册</h3>
  </div>
  <div class="modal-body">
  
    <?php
      $RegistrationForm = new YumRegistrationForm('registration');
      $profile = new YumProfile('registration');
      $activeform=$this->beginWidget('CActiveForm', array(
		'id'=>'registration-form',
      	'action'=>'/register',
      	'enableAjaxValidation'=>true,
		'enableClientValidation'=>true,
		'clientOptions'=>array(
			'validateOnSubmit'=>false,
			'afterValidate'=>'js:function(form,data,hasError){
				if(!hasError){
					$.ajax({
					"type":"POST",
					"url":"/register",
					"data":$("#registration-form").serialize(),
					"success":function(data){$("#searchResults").html(data);},
					
					});
				}
			}'
		),
	)); ?>
	
		<div class="modal-row"> <?
		echo $activeform->labelEx($RegistrationForm,'username');
		echo $activeform->textField($RegistrationForm,'username');
		?> </div>
		
		<div class="modal-row">
		<?php echo $activeform->labelEx($RegistrationForm,'password'); ?>
		<?php echo $activeform->passwordField($RegistrationForm,'password'); ?>
		</div>
	
		<?php if(extension_loaded('gd')  && Yum::module('registration')->enableCaptcha): ?>
		<div class="modal-row">
			<?php echo CHtml::activeLabelEx($RegistrationForm,'verifyCode'); ?>
			<div>
				<?php echo CHtml::activeTextField($RegistrationForm,'verifyCode'); ?>
				<?php $this->widget('CCaptcha',array('captchaAction'=>'/registration/registration/captcha')); ?>
				
			</div>
		
		</div>
		<?php endif; ?>
	
		<div class="modal-row submit">
			<?php echo CHtml::submitButton('注册',array('class'=>'btn btn-info')); ?>
			<?php if(0):?>
			<?php echo CHtml::submitButton(Yum::t('Registration')); ?>
			<?php endif;?>
		</div>

	<?php $this->endWidget(); ?>
	     
  </div>
  <div class="modal-footer">
    <button class="btn hide" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-danger"  data-dismiss="modal" aria-hidden="true">关闭</button>
  </div>
</div>

<?php endif;?>
  
</body>
</html>
